package com.bkgy.controller.tpdol3data.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bkgy.commom.model.Temp;
import com.bkgy.controller.tpdol3data.dao.TPdoL3Cal1630Dao;
import com.bkgy.controller.tpdol3data.entity.TPdoDataL3Cal1630;
import com.bkgy.controller.tpdol3data.entity.dto.TpdoL3CalBaseInfoRes;
import com.bkgy.controller.tpdol3data.entity.dto.TpdoL3CalDownRes;
import com.bkgy.controller.tpdol3data.entity.dto.TpdoL3CalRunRes;
import com.bkgy.controller.tpdol3data.service.ITPdoL3Cal1630Service;
import com.bkgy.sys.common.entity.ResultData;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Service
@RequiredArgsConstructor
public class TPdoL3Cal1630Servicempl extends ServiceImpl<TPdoL3Cal1630Dao, TPdoDataL3Cal1630> implements ITPdoL3Cal1630Service {
    private final TPdoL3Cal1630Dao mapper;

    @Override
    public ResultData<TpdoL3CalBaseInfoRes> findBaseInfo() {
        TpdoL3CalBaseInfoRes baseInfo = new TpdoL3CalBaseInfoRes();
        baseInfo.setShengchanl(BigDecimal.ZERO);
        baseInfo.setZhitongl(BigDecimal.ZERO);
        baseInfo.setZhitongbl(BigDecimal.ZERO);
        baseInfo.setJihuacl(BigDecimal.valueOf(558.65));
        baseInfo.setShijicl(BigDecimal.valueOf(535.87));
        baseInfo.setDachengl(BigDecimal.valueOf(0.9592));
        baseInfo.setYuechanl(BigDecimal.valueOf(59893.27));

        baseInfo.setChengcaijh(BigDecimal.valueOf(0.9750));
        baseInfo.setChengcaisj(BigDecimal.valueOf(0.9688));
        baseInfo.setChengcaijg("超欠");
        baseInfo.setChengcaijgz(BigDecimal.ZERO);

        baseInfo.setFeicilzb(BigDecimal.ZERO);
        baseInfo.setDangrifcl(BigDecimal.ZERO);
        baseInfo.setYueleijfcl(BigDecimal.ZERO);

        return ResultData.ResultDataSuccess(baseInfo);
    }

    @Override
    public ResultData<List<TpdoL3CalRunRes>> findRunList() {
        List<TpdoL3CalRunRes> runList = new ArrayList<>();
        TpdoL3CalRunRes obj1 = new TpdoL3CalRunRes();
        obj1.setShiduan("00：00-03:00");
        obj1.setShichang("");
        obj1.setYingxiangcl(BigDecimal.valueOf(70));
        obj1.setShuoming("生产DP钢由于快冷风机能力不足影响产量");
        runList.add(obj1);

        TpdoL3CalRunRes obj2 = new TpdoL3CalRunRes();
        obj2.setShiduan("06:00-24:00");
        obj2.setShichang("");
        obj2.setYingxiangcl(BigDecimal.valueOf(0));
        obj2.setShuoming("停机检修");
        runList.add(obj2);

        return ResultData.ResultDataSuccess(runList,runList.size());
    }

    @Override
    public ResultData<List<TpdoL3CalDownRes>> findDownList() {
        List<TpdoL3CalDownRes> downList = new ArrayList<>();
        return ResultData.ResultDataSuccess(downList,downList.size());
    }

    @Override
    public ResultData<List<TpdoL3CalDownRes>> findCloseList() {
        List<TpdoL3CalDownRes> closeList = new ArrayList<>();
        TpdoL3CalDownRes obj1 = new TpdoL3CalDownRes();
        obj1.setMingcheng("卷取内径不符");
        obj1.setJiangjil(BigDecimal.valueOf(7.79));
        obj1.setGuihu("制造部计划");
        obj1.setGuigeCol1("SPCC");
        obj1.setGuigeCol2(BigDecimal.valueOf(1.5));
        obj1.setGuigeCol3(BigDecimal.valueOf(1250));
        obj1.setYuanyin("封闭，内径不符封闭。计划610，连退实际508卷取，精整需更换610进行卷取。出口单机卷取更换套筒操作侧堵边套量高导致无法使用610卷取。下表面中间断续轻微夹杂亮印如需降级归户原料。局部轻微氧化铁皮，表面偶尔污迹。");
        closeList.add(obj1);

        TpdoL3CalDownRes obj2 = new TpdoL3CalDownRes();
        obj2.setMingcheng("夹杂");
        obj2.setJiangjil(BigDecimal.valueOf(55.96));
        obj2.setGuihu("北营炼钢");
        obj2.setGuigeCol1("DC01-H");
        obj2.setGuigeCol2(BigDecimal.valueOf(1.55));
        obj2.setGuigeCol3(BigDecimal.valueOf(1219));
        obj2.setYuanyin("封闭，制程在连退切边范围不在连退，1630检修无法编入计划，已联系科室同意不切边，此卷未切边，下大卷，已涂油取样。头尾下表面划伤，切除归连退机械。来料两侧肋部偶尔轻微斜纹，痕迹无手感，符合FB。钢种过渡加热温度波动大。");
        closeList.add(obj2);

        TpdoL3CalDownRes obj3 = new TpdoL3CalDownRes();
        obj3.setMingcheng("厚度不均");
        obj3.setJiangjil(BigDecimal.valueOf(49.62));
        obj3.setGuihu("北营轧钢");
        obj3.setGuigeCol1("DC01-H");
        obj3.setGuigeCol2(BigDecimal.valueOf(1.15));
        obj3.setGuigeCol3(BigDecimal.valueOf(1219));
        obj3.setYuanyin("封闭，夹杂封闭，带尾70米夹杂精整切除。带头980米-1020米上表面乳化液斑，观察涂油后效果如需降级归户酸轧机械（酸轧不良品要求归户酸轧机械），局部轻微夹杂亮印，表面偶尔污迹。");
        closeList.add(obj3);

        return ResultData.ResultDataSuccess(closeList,closeList.size());
    }

    @Override
    public List<Temp> selectPage(int rollNum) {
        return mapper.selectLastRoll(rollNum);
    }
}